package swf;

class ExportAssets extends String {
	public function new ( assets : Array<{ id : Int, name : String }> ) {
		var count = UI16.fromInt( assets.length );
		var list = "";
		for( asset in assets ) {
			list += UI16.fromInt( asset.id );
			list += asset.name + String.fromCharCode( 0 );
		}
		
		var content = count + list;
		var header = RecordHeader.create( 56, content.length );
		
		super( header + content );
		
	}
	
	public function toString () : String {
		return this;
	}
/*		
	public static function create ( assets : Array<{ id : Int, name : String }> ) : String {
		var count = UI16.fromInt( assets.length );
		var list = "";
		for( asset in assets ) {
			list += UI16.fromInt( asset.id );
			list += asset.name + String.fromCharCode( 0 );
		}
		
		var content = count + list;
		var header = RecordHeader.create( 56, content.length );
		
		return header + content;
	}
*/
}
